<?php
header('Content-Type:text/html;charset=utf-8');
//引入全局配置文件
require_once './configs/config.php';
//引入模板配置文件
require_once './configs/smarty.conf.php';
#name-value
$title="HomePage";
$smarty->assign("title",$title);

#一维数组-无键值对
$info=array("Ian","25","1");
$smarty->assign("info",$info);

#一维数组-有键值对
$person=array("name"=>"Ian","age"=>"25","sex"=>"1");
$smarty->assign("person",$person);

#二维数组
$news[]=array("name"=>"New","keys"=>"控股","contents"=>"我要");
$news[]=array("name"=>"Job","keys"=>"公司","contents"=>"努力");
$news[]=array("name"=>"NBO","keys"=>"工作","contents"=>"工作");
$smarty->assign("news",$news);

#变量调节
$name="ian";
$smarty->assign("name",$name);

#判断语句
$age=18;
$smarty->assign("age",$age);

#禁止缓存
function insert_nocache()
{
	#global $age  [global $obj];
	#$age++       [global $obj->row];
	#return $age  [$result];
	return time();
}

#模板包含
#{(include file='./header.html')}

#剔除空格
#{(strip)}{(/strip)}

#模板文件
$smarty->display("index.html");

#局部缓存
#$id=$_GET["id"];
#$smarty->display("index.html",$id);
#$smarty->clear_cache('index.html',$id);

?>